package com.example.korimako;



import com.example.korimako.R;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		Button btnGoButton = (Button)findViewById(R.id.Button01);
		btnGoButton.setOnClickListener(new Button.OnClickListener(){
		
			@Override
			public void onClick(View view) {
				// TODO Auto-generated method stub
				
				EditText editTxt= (EditText)findViewById(R.id.EditText01);
				String edString = editTxt.getText().toString();
				//editTxt.getText().toString();
				
				//new a Intent and assign the Activity of class
				Intent intent = new Intent();
				intent.setClass(MainActivity.this , MainActivity2.class);
				
				
				//new a Bundle and passing the parameter
				//Bundle bundle = new Bundle();
				Person person = new Person();
				person.gender="male";
				person.height=Double.parseDouble(edString);
				
				//bundle.putAll(null);
				
				//assign Bundle to intent
				//intent.putExtras(bundle);
				intent.putExtra("Person", person);
				
				//change Activity
				startActivity(intent);
			}
			
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_main, menu);
		return true;
	}

}
